import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
import { getGameChannel } from '@/api/game';

export const useGameChannelStore = defineStore('gameChannel', () => {
  const gameChannleList = ref<any[]>([]);

  function updateChannel() {
    getGameChannel()
    .then((res: any) => {
      if (Array.isArray(res)) {
        gameChannleList.value = [...res];
      }
    })
    .catch((err: any) => {
      console.log(err);
    })
  }
  

  return { gameChannleList, updateChannel }
})
